-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(wallet-dashboard): other assets #4574
Conversation
This pull request has been deployed to Vercel. Latest commit: f62f401 ✅ Preview: https://wallet-dashboard-bjjykixrs-iota1.vercel.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a nit about code optimization and reverting code added in previous PR
const visualAssets: IotaObjectData[] = []; | ||
const otherAssets: IotaObjectData[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we simplified this code by removing visualAssets
and otherAssets
based on the comment in this PR > #4038 (comment)
with this PR we would be reverting back the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That code was incorrect because the objects were always pushed to assets array
if (selectedCategory == AssetCategory.Visual) { if(hasDisplayData(asset)) { assets.push(asset.data); } } else if(selectedCategory == AssetCategory.Other) { assets.push(asset.data); }
I have added a Map to simplify the code, but also to be able to separate it into the 2 categories, take a look and tell me what you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think that it was correct because only one array is shown at a time. that means that everything can be stored in the same array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request has been deployed to Vercel. Latest commit: 9b816ec ✅ Preview: https://wallet-dashboard-4gkgpiyw7-iota1.vercel.app |
@@ -31,21 +31,23 @@ export default function AssetsDashboardPage(): React.JSX.Element { | |||
const account = useCurrentAccount(); | |||
const { data, isFetching, fetchNextPage, hasNextPage, refetch } = useGetOwnedObjects( | |||
account?.address, | |||
undefined, | |||
{ | |||
MatchNone: [{ StructType: '0x2::coin::Coin' }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MatchNone: [{ StructType: '0x2::coin::Coin' }], | |
MatchNone: [{ StructType: COIN_TYPE }], |
OBJECTS_PER_REQ, | ||
); | ||
|
||
const assets: IotaObjectData[] = []; | ||
const assets = new Map<string, IotaObjectData[]>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const assets = new Map<string, IotaObjectData[]>( | |
const assets = new Map<AssetCategory, IotaObjectData[]>( |
OBJECTS_PER_REQ, | ||
); | ||
|
||
const assets: IotaObjectData[] = []; | ||
const assets = new Map<string, IotaObjectData[]>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't have used a Map
as you already know what/how many entries are going to be, I would just have made it a record like ASSET_CATEGORIES
, just a thought 👍🏻
This pull request has been deployed to Vercel. Latest commit: 71d93ce |
This pull request has been deployed to Vercel. Latest commit: 71d93ce ✅ Preview: https://rebased-explorer-2b6go5lxd-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 71d93ce ✅ Preview: https://wallet-dashboard-9dcbepyg2-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: f1a82ec |
This pull request has been deployed to Vercel. Latest commit: f1a82ec ✅ Preview: https://rebased-explorer-6rhkatgym-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: f1a82ec ✅ Preview: https://wallet-dashboard-hq59iy3pg-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 3dfce33 |
This pull request has been deployed to Vercel. Latest commit: 3dfce33 ✅ Preview: https://rebased-explorer-bo3hj1sjf-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 3dfce33 ✅ Preview: https://wallet-dashboard-3ga6kz17x-iota1.vercel.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎊
This pull request has been deployed to Vercel. Latest commit: baebe6b |
This pull request has been deployed to Vercel. Latest commit: baebe6b ✅ Preview: https://rebased-explorer-p5opjiayo-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: baebe6b ✅ Preview: https://wallet-dashboard-edtkuc4vm-iota1.vercel.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good 🚀
Just FYI this PR might be crossing with #4512
@@ -24,7 +25,7 @@ export async function split_coin(address: string) { | |||
const tx = new Transaction(); | |||
tx.moveCall({ | |||
target: '0x2::pay::split', | |||
typeArguments: ['0x2::iota::IOTA'], | |||
typeArguments: [COIN_TYPE], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this!!
This pull request has been deployed to Vercel. Latest commit: dfba076 |
This pull request has been deployed to Vercel. Latest commit: dfba076 ✅ Preview: https://rebased-explorer-i44ofv6wx-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: dfba076 ✅ Preview: https://wallet-dashboard-1jzyxng79-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: dc3ea7f |
This pull request has been deployed to Vercel. Latest commit: dc3ea7f ✅ Preview: https://rebased-explorer-pjifjxyrv-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: dc3ea7f ✅ Preview: https://wallet-dashboard-e1vgf7s14-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 060870c |
This pull request has been deployed to Vercel. Latest commit: 060870c ✅ Preview: https://rebased-explorer-jaal8672i-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 060870c ✅ Preview: https://wallet-dashboard-q5s40i04z-iota1.vercel.app |
* fix(wallet-dashboard): other assets * fix(dashboard): simplified code * feat(core): add a new COIN_TYPE constant * fix(dashboard): revert changes of assets array and use new COIN_TYPE constant * fix(dashboard): improve the assets filter * fix(core): linter * fix(explorer): Revert localnet.ts * fix(core): Revert timelock.constants.ts * ' --------- Co-authored-by: Bran <[email protected]> Co-authored-by: marc2332 <[email protected]>
Description of change
Other assets in the dashboard should not contain Coins nor NFTs, it contains at least coins for now
Other assets should just open a new tab in the explorer
Links to any relevant issues
Closes #4572
Type of change
Choose a type of change, and delete any options that are not relevant.
How the change has been tested
Describe the tests that you ran to verify your changes.
Make sure to provide instructions for the maintainer as well as any relevant configurations.
Change checklist
Tick the boxes that are relevant to your changes, and delete any items that are not.